package study.javaee.practice.dao;

import study.javaee.practice.entity.JpaMd5user;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

public interface JpaMd5userDAO extends JpaRepository<JpaMd5user,Integer>{

    @Query("select m from JpaMd5user m where m.name = ?1")
    JpaMd5user findByName(String username);

    @Query("select m from JpaMd5user m where m.id = ?1")
    JpaMd5user findById(int id);

    @Query("select m from JpaMd5user m where m.name = ?1 and m.password = ?2")
    JpaMd5user getByNameAndPassword(String username, String password);

    @Query("select m from JpaMd5user m where m.email = ?1 and m.password = ?2")
    JpaMd5user getByEmailAndPassword(String email, String password);

}
